package com.tuanzi.loan.business.entity.system;

import com.tuanzi.loan.core.entity.AuditEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

import javax.persistence.*;
import javax.validation.constraints.NotNull;

/**
 * @author Ray 2017/09/21
 */
@Data
@Entity
@Table(name = "TB_LOAN_DATA_PERMISSION_RELATION")
@EqualsAndHashCode(callSuper = true)
public class DataPermissionRelation extends AuditEntity {

    private static final long serialVersionUID = -6018224722083202094L;

    @Id
    @GeneratedValue(generator = "uuid2")
    @GenericGenerator(name = "uuid2", strategy = "org.hibernate.id.UUIDGenerator")
    private String id;
    
    @NotBlank
    @Length(max = 36)
    @Column(name = "PERMISSION_ID")
    private String permissionId;

    @NotNull
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "RELATION_TYPE")
    private RelationType relationType;

    @NotBlank
    @Length(max = 36)
    @Column(name = "RELATION_ID")
    private String relationId;

}
